package com.ae.flock;

import java.util.ArrayList;

import com.ae.Quackable;
import com.ae.observer.Observer;

public class Flock implements Quackable {
	
	ArrayList<Quackable> quackers= new ArrayList<Quackable>(); 

	public void add(Quackable quacker) {
		quackers.add(quacker);
	}
	@Override
	public void quack() {
		for( Quackable quacker : quackers ) {
			quacker.quack();
		}

	}
	@Override
	public void registerObserver(Observer o) {
		for ( Quackable q : quackers ) {
			q.registerObserver(o);
		}
		
		
	}
	@Override
	public void notifyObserver() {
		for ( Quackable q : quackers ) {
			q.notifyObserver();
		}		
	}

}
